#ifndef GPIO_PWM_H
#define GPIO_PWM_H

#include <QObject>
#include "pwm/gpio_pwm_thread.h"

class gpio_pwm : public QObject
{
    Q_OBJECT

private:
    char gpio_path[100]{};
    qint64 duty = 0;
    qint64 period = 0;

    int gpio_config(const char *attr, const char *val);
    gpio_pwm_thread *thread = nullptr;

public:
    explicit gpio_pwm(QObject *parent = nullptr,qint8 gpio_sec = 38,qint64 period = 20000000,qint64 duty = 1000000);
    virtual ~gpio_pwm();

public:
    void set_duty(qint64 duty);
    void pwm_out_stop();
    void pwm_out_start();
    qint64 get_duty();
    qint64 get_period();

private slots:
    void duty_time_out_slots();
    void period_time_out_slots();

signals:

};

#endif // GPIO_PWM_H
